package cn.gok.front.config;

import cn.gok.front.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: chenfan
 * @Description:
 */
@Configuration
public class MyWebConfig implements WebMvcConfigurer {

    @Autowired
    LoginInterceptor loginInterceptor;

    /**
     *  将自定义的拦截器进行注册
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                //指定拦截哪些路径
                .addPathPatterns("/**")
                //指定放过哪些请求
                .excludePathPatterns("/user/login.do","/user/forget_get_question.do","/user/forget_check_answer.do");
    }
}
